#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>

#include "connecting.h"
#include "playing.h"


int main()
{
    int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
    ShakeHandInfo shake_hand_info;

    if (sockfd < 0) {
        perror("socket creation failed");
        exit(EXIT_FAILURE);
    }

    printf("waiting for connection.\n");
    shake_hand_info = Connecting_ShakeHand(sockfd);

    printf("start to play.\n");
    Playing_StartGame(sockfd, shake_hand_info.player_mode, shake_hand_info.opponent_address);

    return 0;
}
